import request from '../utils/request'

export interface CodeData {
	code: string
}

export interface LoginData {
	phone: string
}

export const getPhoneNumber = async (data: CodeData) =>
	await request(`/wx-api/getPhoneNumber`, 'POST', data)

export const wxUserLogin = async (data: LoginData) =>
	await request(`/wx-user/login`, 'POST', data)

export const updateUser = async (id: string, data: User) =>
	await request(`/wx-user/${id}`, 'PATCH', data)

export const getNewUser = async (id: string) =>
	await request(`/wx-user/new/${id}`, 'GET')

export const checkToken = async (id: string) =>
	await request(`/wx-user/token/${id}`, 'GET')